#pragma once
#include "Header.h"
#include "ntstruct.h"
#include <ntimage.h>
#include "nefunction.h"

#define RvaToVa(m, r) ((PCHAR)m + (ULONG)r)

void LoadImageNotifyRoutine(
    IN OPTIONAL PUNICODE_STRING FullImageName,
    IN HANDLE ProcessId,
    IN PIMAGE_INFO ImageInfo
);

BOOLEAN CompareLongShortName(IN PUNICODE_STRING lpusLongName, IN PUNICODE_STRING lpusShortName, IN BOOLEAN bCaseInSensitive);

void* Mm2SearchFor(
    IN const void* lpBuff,
    IN size_t stBuffLen,
    IN const void* lpSub,
    IN size_t stSubLen
);

ULONG_PTR ImFindNoExportedFunction(
    IN unsigned char* lpstrMk1,
    IN ULONG Mk1Size,
    IN unsigned char* lpstrMk2,
    IN ULONG Mk2Size,
    IN ULONG Mk1ToMk2,
    IN ULONG Mk1ToHead
);

PVOID ImGetImageSection(_In_ PVOID ImageBase, _In_ const char* SectionName, _Out_opt_ PSIZE_T SizeOfSection);

ULONG_PTR ImGetImageBase(_In_opt_ const char* ImageName, _Out_opt_ PSIZE_T SizeOfImage);

PVOID ImGetModuleExportFunction(IN PVOID lpModuleBase, IN PCHAR lpExportName);

ULONG_PTR Ps2GetModuleBase32(IN PEPROCESS lpEprocess, IN PPEB32 lpPeb32, IN PUNICODE_STRING lpusModuleName);

ULONG_PTR Ps2GetModuleBase64(IN PEPROCESS lpEprocess, IN PPEB64 lpPeb64, IN PUNICODE_STRING lpusModuleName);

PETHREAD Ps2GetProcessMainThread(IN PEPROCESS lpEprocess);
